<?php

namespace createComments;

class CreateComments{
	
	private $con;
	
	public function __construct(){
			
		$this->con = mysqli_connect("localhost", "root", "", "benny");
	
		// Check connection
		if (mysqli_connect_errno())
		{
		echo "Failed to connect to MySQL: " . mysqli_connect_error();
		}	
	}
	
	public function saveComments($pictureId, $user, $comments){
		mysqli_query($this->con,"INSERT INTO comments (Id, User, comments)
			VALUES ('$pictureId', '$user', '$comments')");
			mysqli_close($this->con);
			echo"succeded to add comment";	
	}
	
	
	
}
